package com.lzit.smart_canteen.utils;

import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Service
public class TimeUtil {
    public static SimpleDateFormat YMDHMS = new SimpleDateFormat("yyyyMMddHHmmss");
    public static SimpleDateFormat YMD_HMS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public Calendar cal = Calendar.getInstance();
    public static<T> String formatYmdhms() throws ParseException {
        Date date = new Date();
        return YMDHMS.format(date);
    }
    public static<T> Date formatYmd_hms() throws ParseException {
        Date date = new Date();
        return YMD_HMS.parse(YMD_HMS.format(date));
    }
}
